//
//  WeakProxy.m
//  justAtest
//
//  Created by huangbolun on 2018/1/5.
//  Copyright © 2018年 huangbolun. All rights reserved.
//

#import "BLWeakProxy.h"

@implementation BLWeakProxy

- (instancetype)initWithTarget:(id)target {
    _target = target;
    return self;
}

+ (instancetype)proxyWithTarget:(id)target {
    return [[BLWeakProxy alloc] initWithTarget:target];
}

- (void)forwardInvocation:(NSInvocation *)invocation{
    SEL sel = [invocation selector];
    if ([self.target respondsToSelector:sel]) {
        [invocation invokeWithTarget:self.target];
    }
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel{
    return [self.target methodSignatureForSelector:sel];
}


- (BOOL)respondsToSelector:(SEL)aSelector{
    return [self.target respondsToSelector:aSelector];
}

- (void)dealloc {
    NSLog(@"proxy dealloc");
}
@end
